const fs = require('fs');
const path = require('path');
// getIndexData()

exports.getIndexData = function(callback) {
    var jsonPath = path.resolve(__dirname, '..')
    var datas = []
    fs.readFile(`${jsonPath}/goodsList1.json`, 'utf8', function(err, res) {
        if (err) throw err;
        datas.push(JSON.parse(res))
        fs.readFile(`${jsonPath}/goodsList2.json`, 'utf8', function(err1, res1) {
            if (err1) throw err1;
            datas.push(JSON.parse(res1))
            fs.readFile(`${jsonPath}/goodsList3.json`, 'utf8', function(err2, res2) {
                if (err1) throw err1;
                datas.push(JSON.parse(res2))
                callback && callback(datas)
            })

        })
    })

};
// exports = getIndexData